package com.mzkj.wanjulaile.mobile.api.modules.activeConfig.entity;

import com.mzkj.wanjulaile.mobile.api.common.entity.DataEntity;
import com.mzkj.wanjulaile.mobile.api.modules.sys.constant.PlantFormConstant;

/**
 * banner活动配置Entity
 * @author ianly
 * @version 2017-02-07
 */
public class BannerConfig extends DataEntity<BannerConfig> {
	
	private static final long serialVersionUID = 1L;
	private String name;		// 名称
	private String introduce;		// 简介
	private String picUrl;		// 图片地址
	private String picLink;		// 点击图片跳转链接
	private String platform;		// 展示平台 1:微信 2:Android 3:iOS
	private Integer sort;		// 排序
	private String showFlag;		// 是否显示
	private String type;	//类型 0新用户可见 1会员可见 2 过期会员可见

	private String platformText;	//平台文本展示
	
	public BannerConfig() {
		super();
	}

	public BannerConfig(String id){
		super(id);
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public String getIntroduce() {
		return introduce;
	}

	public void setIntroduce(String introduce) {
		this.introduce = introduce;
	}
	
	public String getPicUrl() {
		return picUrl;
	}

	public void setPicUrl(String picUrl) {
		this.picUrl = picUrl;
	}
	
	public String getPicLink() {
		return picLink;
	}

	public void setPicLink(String picLink) {
		this.picLink = picLink;
	}
	
	public String getPlatform() {
		return platform;
	}

	public void setPlatform(String platform) {
		this.platform = platform;
	}
	
	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}
	
	public String getShowFlag() {
		return showFlag;
	}

	public void setShowFlag(String showFlag) {
		this.showFlag = showFlag;
	}

	public String getPlatformText() {
		String platformText = "";
		if (platform.contains(",")){
			String[] split = platform.split(",");
			for (String s :split){
				platformText = getPlatFormString(platformText, s);
			}
		}else {
			platformText = getPlatFormString(platformText,platform);
		}
		return platformText.substring(0,platformText.length()-1);
	}

	private String getPlatFormString(String platformText, String s) {
		if (PlantFormConstant.WECHAT_PLATFORM.equals(s)){
            platformText +="公众号,";
        }
		if (PlantFormConstant.IOS_PLATFORM.equals(s)){
            platformText += "iOS,";
        }
		if (PlantFormConstant.ANDROID_PLATFORM.equals(s)){
            platformText += "Android,";
        }
		return platformText;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
}